package com.um.jdy.app.shop.controller;

import com.um.jdy.app.base.entity.dto.AddQrcodeDTO;
import com.um.jdy.app.base.manager.KeywordManager;
import com.um.jdy.app.base.manager.QrcodeManager;
import com.um.jdy.common.shop.entity.dto.QrcodeDTO;
import com.um.jdy.common.shop.entity.vo.KeywordVO;
import com.um.springboot.starter.orm.entity.Response;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import java.util.List;

/**
 * 控制器：搜索热门关键词
 */
@RestController
@RequestMapping("/api/v1/shop/qrcode")
@Api(tags = "基础", description = "小程序二维码")
@Validated
public class QrcodeController {

    @Autowired
    QrcodeManager qrcodeManager;

    @ApiOperation("生成小程序码")
    @PostMapping()
    public Response<String> generateQrcode(@Valid @RequestBody AddQrcodeDTO dto){
        return Response.success(qrcodeManager.generateQrcode(dto));
    }

    @ApiOperation("查询小程序码数据")
    @GetMapping("/{scene}")
    public Response<String> get(String scene){
        return Response.success(qrcodeManager.get(scene));
    }

}
